# Contributor: Galen Abell <galen@galenabell.com>
# Maintainer: Galen Abell <galen@galenabell.com>
pkgname=k9s
_pkgname=github.com/derailed/k9s
pkgver=0.20.2
pkgrel=0
_commit=218388c # git rev-parse --short HEAD
_date=2020-06-02T15:50:42UTC # date -u -d @$(date +%s) +%FT%T%Z
pkgdesc="Kubernetes TUI"
url="https://k9scli.io"
arch="all !x86 !mips64" # tests fail on x86 for some reason, missing go on mips
license="Apache-2.0"
makedepends="go"
options="net chmod-clean"
source="$pkgname-$pkgver.tar.gz::https://github.com/derailed/k9s/archive/v$pkgver.tar.gz"

export GOPATH="$srcdir/go"
export GOCACHE="$srcdir/go-build"
export GOTMPDIR="$srcdir"

build() {
	local ldflags="-w -s -X $_pkgname/cmd.version=$pkgver -X $_pkgname/cmd.commit=$_commit -X $_pkgname/cmd.date=$_date"
	go build -ldflags "$ldflags" -a -tags netgo -o execs/$pkgname main.go
}

check() {
	go test ./...
}

package() {
	install -Dm755 execs/$pkgname "$pkgdir"/usr/bin/$pkgname
}

sha512sums="4ba2dd5fbc7da084e33cd4688b6689395a13a2192867597dccf1057cb052598d03d87d03cd08d02e0c25f5cdaec786add2b0c019d8fbc0fd67841b3ae0993025  k9s-0.20.2.tar.gz"
